package com.jibei.mendo.utils;

import android.os.Environment;

import java.net.InetAddress;

/**
 * Created by Devin on 2019/8/11.
 */
public class Constant {

    public static final String LIB_DIR = Environment.getExternalStorageDirectory().getAbsolutePath() + "/mendo";
    public static final String EXCEL_DIR = LIB_DIR + "/excel";
    public static final String FIRMWARE_DIR = LIB_DIR + "/firmware/ltcsmpte.ino.with_bootloader.hex";
    public static final String TAG = "LY";
    public static final String I_AM_SERVER = "iamserver";
    public static final String I_AM_CLIENT = "iamclient";
    public static final String READY = "F00102E601";//预备的命令
    public static final String RELEASE = "F00102E701";//释放的命令
    public static final String REMOTIP = "RIPN";
    public static final String LOCALID = "LOIDN";
    public static final String CURRENTITEM = "CEMN";
    public static final String MASTERSLAVER = "MASLN";
    public static String SERVER_IP = "192.168.1.4";
    public static final int SERVER_PORT = 5050;

    public class Events {
        /**
         * 旋转按钮的状态
         */
        public static final int DIAN_HUO = 0x01;//点火
        public static final int KONG_DANG = 0x00;//空挡
        public static final int JIAN_CE = 0x02;//检测

        /**

         */
        public static final int DIAN_HUO_PRESS = 0x03;//按压点火
        public static final int READY_PRESS = 0x04;//按压预备

        /**
         * excel表的数据返回
         */
        public static final int EXCEL_TOTAL_TIMER = 0x05;//总燃放时间
        public static final int EXCEL_ITEM_NEXT_TIMER = 0x06;//第一次距离下次的燃放时间

        /**
         * 错误集
         */
        public static final int COMMAND_READY_ERROR_LIST = 0x07;
        public static final int COMMAND_RELEASE_ERROR_LIST = 0x08;
        public static final int COMMAND_CHECK_ERROR_LIST = 0x09;
        public static final int COMMAND_CONFIG_ERROR_LIST = 0x10;

        public static final int BACK_COMMAND = 0x99;//返回的指令
        /**
         * 主机模式 从机模式 状态
         */
        public static final int DEVICE_MARSTER_SET = 0x11;
        public static final int DEVICE_SLAVER_SET = 0x12;

        /*
         * 点火界面设置单步点火和全局暂停
         * */
        public static final int AUTO_MANU_FIRE_A = 0x13;
        public static final int AUTO_MANU_FIRE_M = 0x15;
        public static final int PAUSE_CONTINUE_P = 0x14;
        public static final int PAUSE_CONTINUE_C = 0x16;

        //Services update UI
        public static final int UPDATEUI = 0x17;

        public static final int UPDATEUI_D = 0x117;

        //更新点火界面初始化时间显示
        public static final int UPDATE_DIANHUO_INIT_VIEW = 0x18;

        //内部存儲需要的1、globle_ID; 2、globle_role;
        public static final int GLOBLE_ID = 0x19;
        public static final int GLOBLE_ROLE = 0x20;

        //Time Code info
        public static final int TIME_CODE = 0x21;
        //
        public static final int TIME_CODE_BYTE_ARRAY = 0x22;

        public static  final  int POSTFIRECMD = 0x23;
        public static final int ID_FROM_EXCEL = 0x24;
        public static final int ROLE_FROM_EXCEL = 0x25;
        //Web states
        public static final int SERVER2CLIENTSUCCESS = 0x26;
        public static final int CLIENT2SERVERSUCCESS = 0x27;
    }

    /**
     * PG的状态
     * 有如下的状态：点火；空挡；检测（包括但不限于此）
     * <p>
     * 文档中的说明：
     * PG0	序列号192，
     * PG1 序列号193，
     * PG2	序列号194，
     * PG3 序列号195，
     * PG4	序列号196，
     * PG5 序列号197，
     * PG8 序列号200，
     * PG12 序列号204，
     * PG13 序列号205，
     * PH8 序列号232，
     * PH9 序列号233
     */
    public class PG {
        public static final int PG1 = 193;
        public static final int PG3 = 195;
        public static final int PG4 = 196;
        public static final int PG5 = 197;
        public static final int PG9 = 233;
        public static final int PG12 = 204;
        public static final int PG13 = 205;
    }
}
